<%-- 
    Document   : dealtruocdaycontent
    Created on : Oct 5, 2011, 11:15:02 PM
    Author     : Administrator
--%>

<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.List"%>
<%@page import="org.hibernate.HibernateException"%>
<%@page import="hibernate.pojo.Sanpham"%>
<%@page import="java.text.DecimalFormat"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<div id="static">
    <div class="StaticTopPanel"><h2 class="TitleMain">Deal trước đây</h2></div>
    <!-- End .StaticTopPanel -->		           
    <div class="OuterContent" style="padding:0;">
        <!-- SEARCH -->	
        <span style="display: block; height: 10px;">&nbsp;</span>
        <div id="BoxSearch">
            <form name="searchdeal" method="post" action="searchcontroller?action=search&amp;active=2" class="frmNapThe frmQLDH2" id="RecentDealSearchForm">                    		
                <fieldset style="background:none;border:none;margin:0;">
                    <ul>
                        <li>
                            <p>
                                <label class="RegLS">Tìm kiếm</label>
                            </p>
                            <ul class="Radio">
                                <li>
                                    <label class="Reg-date">Từ khoá</label>
                                    <input type="text" name="keyWord" style="width:262px;" value="" />	          						
                                </li>	        					
                            </ul>
                        </li>

                        <li>
                            <p>
                                <label class="RegLS">&nbsp;</label>
                            </p>
                            <ul class="Radio">
                                <li>
                                    <label class="Reg-date">Thể loại</label>
                                    <select name="category" style="width: 264px; border: 1px solid #89B4D6">
                                        <option value="">Tất cả</option>
                                        <option value="event">Deal Promotion</option>
                                        <option value="restaurant">Nhà hàng</option>
                                        <option value="health">Health Care</option>
                                        <option value="entertainment">Giải trí</option>
                                        <option value="cafe">cafe</option>
                                        <option value="health">Làm đẹp</option>
                                        <option value="studying">Công nghệ</option>
                                        <option value="fashion">Trang sức</option>
                                        <option value="studying">Sách</option>
                                        <option value="fashion">Thời trang</option>
                                        <option value="studying">Học hành</option>
                                        <option value="travel">Du lịch</option>
                                        <option value="yogurt">Yogurt</option>
                                        <option value="spa">Spa</option>
                                        <option value="health">Massage</option>
                                    </select>
                                </li>	        					
                            </ul>
                        </li>

                        <li>
                            <p>
                                <label class="RegLS">&nbsp;</label>
                            </p>
                            <ul class="Radio">	        					
                                <li>
                                    <label class="Reg-date">Từ</label>                                        
                                    <input type="text" name="dateFrom" class="date JsDateTime" value="" />
                                    <span class="JsDateTimeHide hide">
                                        <select name="dayFrom" id="from_dateDay">
                                            <option value="01">1</option>
                                            <option value="02">2</option>
                                            <option value="03">3</option>
                                            <option value="04">4</option>
                                            <option value="05">5</option>
                                            <option value="06">6</option>
                                            <option value="07">7</option>
                                            <option value="08">8</option>
                                            <option value="09">9</option>
                                            <option value="10">10</option>
                                            <option value="11">11</option>
                                            <option value="12">12</option>
                                            <option value="13">13</option>
                                            <option value="14">14</option>
                                            <option value="15">15</option>
                                            <option value="16">16</option>
                                            <option value="17">17</option>
                                            <option value="18">18</option>
                                            <option value="19">19</option>
                                            <option value="20">20</option>
                                            <option value="21">21</option>
                                            <option value="22">22</option>
                                            <option value="23">23</option>
                                            <option value="24">24</option>
                                            <option value="25">25</option>
                                            <option value="26">26</option>
                                            <option value="27">27</option>
                                            <option value="28">28</option>
                                            <option value="29">29</option>
                                            <option value="30">30</option>
                                            <option value="31">31</option>
                                        </select>-<select name="monthFrom" id="from_dateMonth">
                                            <option value="01">01</option>
                                            <option value="02">02</option>
                                            <option value="03">03</option>
                                            <option value="04">04</option>
                                            <option value="05">05</option>
                                            <option value="06">06</option>
                                            <option value="07">07</option>
                                            <option value="08">08</option>
                                            <option value="09">09</option>
                                            <option value="10">10</option>
                                            <option value="11">11</option>
                                            <option value="12">12</option>
                                        </select>-<select name="yearFrom" id="from_dateYear">
                                            <option value="2010">2010</option>
                                            <option value="2011" selected="selected">2011</option>
                                        </select></span>
                                </li>
                                <li>
                                    <label for="denngay" class="Reg-date" style="width: 37px;">Đến</label>                                        
                                    <input type="text" name="dateTo" class="date JsDateTime" value="" />
                                    <span class="JsDateTimeHide hide"><select name="dayTo" id="from_dateDay">
                                            <option value="01">1</option>
                                            <option value="02">2</option>
                                            <option value="03">3</option>
                                            <option value="04"</option>
                                            <option value="05">5</option>
                                            <option value="06">6</option>
                                            <option value="07">7</option>
                                            <option value="08">8</option>
                                            <option value="09">9</option>
                                            <option value="10">10</option>
                                            <option value="11">11</option>
                                            <option value="12">12</option>
                                            <option value="13">13</option>
                                            <option value="14">14</option>
                                            <option value="15">15</option>
                                            <option value="16">16</option>
                                            <option value="17">17</option>
                                            <option value="18">18</option>
                                            <option value="19">19</option>
                                            <option value="20">20</option>
                                            <option value="21">21</option>
                                            <option value="22">22</option>
                                            <option value="23">23</option>
                                            <option value="24">24</option>
                                            <option value="25">25</option>
                                            <option value="26">26</option>
                                            <option value="27">27</option>
                                            <option value="28">28</option>
                                            <option value="29">29</option>
                                            <option value="30">30</option>
                                            <option value="31">31</option>
                                        </select>-<select name="monthTo" id="from_dateMonth">
                                            <option value="01">01</option>
                                            <option value="02">02</option>
                                            <option value="03">03</option>
                                            <option value="04">04</option>
                                            <option value="05">05</option>
                                            <option value="06">06</option>
                                            <option value="07">07</option>
                                            <option value="08">08</option>
                                            <option value="09">09</option>
                                            <option value="10">10</option>
                                            <option value="11">11</option>
                                            <option value="12">12</option>
                                        </select>-<select name="yearTo" id="from_dateYear">
                                            <option value="2010">2010</option>
                                            <option value="2011">2011</option>
                                        </select></span>
                                    <input  type="submit" class="BtnTimMa" value="" style="width:65px;height:36px;background-image:url(DealZing_files/tim-ma.gif)" />
                                </li>
                            </ul>
                            <p></p>
                        </li>	    				
                    </ul>
                </fieldset> 

            </form>
        </div>
        <span style="display: block; height: 10px;">&nbsp;</span>
        <!-- END SEARCH -->

        <ul class="DealList">
            <%
                try 
                {
                    DecimalFormat df = new DecimalFormat("###,###");
                    SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
                    //DanhSachDealTruocDay
                    List<Sanpham> arrSanPham = (List<Sanpham>) request.getAttribute("DanhSachDealTruocDay");
                    if (arrSanPham != null) 
                    {
                        for (int i = 0; i < arrSanPham.size(); i++) 
                        {
                            Sanpham sanpham = arrSanPham.get(i);
            %>
            <li>
                <p class="DealEnd-Time"><img src="DealZing_files/lich0000.gif" width="17" height="18" class="Left" alt="" />Ngày <%=sdf.format(sanpham.getNgayHetHanKhuyenMai())%></p>
                <div class="DealEnd-ContTop">
                    <div class="DealEnd-Cont">
                        <div class="DealEnd-ContBot">
                            <h4>
                                <a href="dealdetailcontroller?action=viewdealdetail&amp;state=close&amp;maSanPham=<%=sanpham.getMaSanPham()%>"><%=sanpham.getTenSanPham()%></a></h4>
                            <div class="Bought">
                                <div class="BoughtPrice">
                                    <p class="TextRight"><strong class="Text18"><span class="c" title=""><%=df.format(sanpham.getGiaBan())%></span></strong>&nbsp;<strong class="Text12">đ</strong></p>
                                </div>
                                <ul class="PriceList">
                                    <li><span class="Left">Giá trị:</span><span 
                                            class="Text12"><span class="c" title=""><%=df.format(sanpham.getTriGia())%></span>đ</span></li>
                                    <li><span class="Left">Tiết kiệm:</span><span 
                                            class="Text12"><span class="c" title=""><%=sanpham.getTietKiem()%></span>đ</span></li>
                                </ul>
                                <p class="TextCenter"><strong class="Text16"><span class="c" title=""><%=sanpham.getLuotMua()%></span></strong> người mua</p>
                            </div>
                            <img src="<%=sanpham.getAnhDaiDien()%>" class="Left" alt="<%=sanpham.getTieuDeSanPham()%>" title="<%=sanpham.getTieuDeSanPham()%>" height="104" width="170" />
                        </div>
                    </div>
                </div>
            </li>
            <%
                        }
                    }
                } catch (HibernateException ex) 
                {
                    out.print(ex);
                }
            %>   
        </ul>
    </div>						            
</div>